module dgl.graphics.FragmentShader;

import tango.io.File;
import tango.stdc.stringz;
import derelict.opengl.gl;

import dgl.graphics.Shader;

class FragmentShader : Shader
{
	public static FragmentShader loadFromFile( char[] filename )
	{
		FragmentShader ret = new FragmentShader();
		
		auto file = new File( filename );
		auto text = cast(char[])file.read();
		auto textPointer = toStringz( text );
		
		ret.m_id = glCreateShader( GL_FRAGMENT_SHADER );
		glShaderSource( ret.m_id, 1, &textPointer, null );
		glCompileShader( ret.m_id );
		
		return ret;
	}
}